/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.travel.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.validator.constraints.Length;

import com.boxin.ims.modules.momarketing.entity.QRCode;
import com.thinkgem.jeesite.common.persistence.BaseEntity;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 车辆Entity
 * @author Jakemanse
 * @version 2013-07-31
 */
@Entity
@Table(name = "ims_travel_bus")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Bus extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private User user; 		// 用户
	private QRCode qrCode;	//
	private String qrcodeNumber;	//二维码编码
	private String flagOrderNumber;	//标标牌顺序号
	private String name; 	// 名称
	private String drivers;	//汽车司机
	private String startPlace;	//出发地
	private String endPlace;		//终点
	private Integer roadType;	//
	private String transport;	//运输信息
	private String tel;			//联系电话
	private String number;		//汽车版照
	private Date createDate;	// 创建日期
	private Date startDate;		//开始时间
	private Date endDate;		//结束时间
	private String roadLine;	//主要途经地
	private String company;		//所属企业
	private String publisher;	//签发人
	private String remarks; // 备注
	
	private String delFlag;	// 删除标记（0：正常；1：删除）

	public Bus() {
		this.createDate = new Date();
		
		this.delFlag = DEL_FLAG_NORMAL;
	}

	public Bus(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_travel_bus")
	//@SequenceGenerator(name = "seq_travel_bus", sequenceName = "seq_travel_bus")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne
	@JoinColumn(name="user_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	@Length(min=1, max=200)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=255)
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	@NotNull
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Length(min=1, max=1)
	public String getDelFlag() {
		return delFlag;
	}

	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}

	public String getDrivers() {
		return drivers;
	}

	public void setDrivers(String drivers) {
		this.drivers = drivers;
	}


	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getRoadLine() {
		return roadLine;
	}

	public void setRoadLine(String roadLine) {
		this.roadLine = roadLine;
	}

	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	
	@ManyToOne
	@JoinColumn(name="qrcode_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public QRCode getQrCode() {
		return qrCode;
	}

	public void setQrCode(QRCode qrCode) {
		this.qrCode = qrCode;
	}

	public Integer getRoadType() {
		return roadType;
	}

	public void setRoadType(Integer roadType) {
		this.roadType = roadType;
	}

	public String getStartPlace() {
		return startPlace;
	}

	public void setStartPlace(String startPlace) {
		this.startPlace = startPlace;
	}

	public String getEndPlace() {
		return endPlace;
	}

	public void setEndPlace(String endPlace) {
		this.endPlace = endPlace;
	}

	public String getTransport() {
		return transport;
	}

	public void setTransport(String transport) {
		this.transport = transport;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}


	public String getFlagOrderNumber() {
		return flagOrderNumber;
	}

	public void setFlagOrderNumber(String flagOrderNumber) {
		this.flagOrderNumber = flagOrderNumber;
	}

	public String getQrcodeNumber() {
		return qrcodeNumber;
	}

	public void setQrcodeNumber(String qrcodeNumber) {
		this.qrcodeNumber = qrcodeNumber;
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		
		sb.append("id:").append(this.id).append("#");
		sb.append("user:").append(this.user).append("#");
		sb.append("qrCode:").append(this.qrCode).append("#");
		sb.append("qrcodeNumber:").append(this.qrcodeNumber).append("#");
		sb.append("flagOrderNumber:").append(this.flagOrderNumber).append("#");
		sb.append("name:").append(this.name).append("#");
		sb.append("drivers:").append(this.drivers).append("#");
		sb.append("startPlace:").append(this.startPlace).append("#");
		sb.append("endPlace:").append(this.endPlace).append("#");
		sb.append("roadType:").append(this.roadType).append("#");
		sb.append("transport:").append(this.transport).append("#");
		sb.append("tel:").append(this.tel).append("#");
		sb.append("number:").append(this.number).append("#");
		sb.append("createDate:").append(this.createDate).append("#");
		sb.append("startDate:").append(DateUtils.formatDate(startDate, "yyyy-mm-dd")).append("#");
		sb.append("endDate:").append(DateUtils.formatDate(endDate, "yyyy-mm-dd")).append("#");
		sb.append("roadLine:").append(this.roadLine).append("#");
		sb.append("company:").append(this.company).append("#");
		sb.append("publisher:").append(this.publisher).append("#");
		sb.append("remarks:").append(this.remarks).append("#");
		
		return sb.toString();
	}
	
	
	
	
}


